package cn.stronglink.asset.terminal.bjc.scrap.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.stronglink.asset.terminal.bjc.scrap.service.ScrapApiService;
import cn.stronglink.asset.terminal.bjc.scrap.vo.ScrapApiVo;
import cn.stronglink.suite.core.base.AbstractController;
@Controller
@RequestMapping(value = "/bjc/scrapApi")
public class ScrapApiController extends AbstractController{
	
	@Autowired
	private ScrapApiService scrapApiService;
	
	// 查询所有报废单
		@RequestMapping(value = "queryScrapList")
		@ResponseBody
		public ResponseEntity<ModelMap> queryScrapList(ModelMap modelMap, HttpServletRequest request,
				HttpServletResponse response, @RequestBody Map<String, Object> params) {	
			List<ScrapApiVo> data = scrapApiService.queryScrapList(params);
			return setSuccessModelMap(modelMap, data);
		}
		
		@RequestMapping(value = "doScrap")
		@ResponseBody
		public ResponseEntity<ModelMap> doScrap(ModelMap modelMap, HttpServletRequest request,
				HttpServletResponse response, @RequestBody ScrapApiVo scrap) {	
			scrapApiService.doScrap(scrap);
			return setSuccessModelMap(modelMap, null);
		}
}
